package com.sen.design.pattern.creational.singleton;

/**
 * 枚举类单例模式：有效防止序列化和反射破坏单例
 */
public enum EnumInstance {

    INSTANCE{
        protected void printTest(){
            System.out.println("hello world");
        }
    };
    protected abstract void printTest();
    private Object data;

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
    public static EnumInstance getInstance(){
        return INSTANCE;
    }
}
